//
//  HLGiftSendRequest.m
//  YueYue
//
//  Created by hulu001 on 2023/6/3.
//

#import "HLGiftSendRequest.h"

@implementation HLGiftSendRequest
{
    NSDictionary *_params;
    HLGiftSendType _type;
}

- (id)initWithType:(HLGiftSendType)type params:(NSDictionary *)params
{
    self = [super init];
    
    if (self) {
        _type = type;
        _params = params;
    }
    
    return self;
}



- (NSString *)requestUrl
{
    switch (_type) {
        case HLGiftSendTypeIM:
            return @"/gift/send";
            break;
        case HLGiftSendTypeVideo:
            return @"/gift/send/video";
            break;
        case HLGiftSendTypeUser:
            return @"/gift/send";
            break;
        case HLGiftSendTypeAudio:
            return @"/gift/send/video";
            break;
        case HLGiftSendTypeBag:
            return @"/active/gift/send";
            break;
    }
    
}

- (YTKRequestMethod)requestMethod
{
    return YTKRequestMethodPOST;
}

- (id)requestArgument
{
    if (_params){
        return _params;
    } else {
        return @{};
    }
}

- (NSString *)userVideoDuration
{
    NSDictionary *data =  self.result[@"data"];
    if ([data isKindOfClass:[NSDictionary class]]){
        NSString *duration = data[@"userVideoDuration"];
        return duration;
    }
    return @"0";
  
}
@end
